<?php

define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

setlocale(LC_ALL, 'es_MX');
date_default_timezone_set('America/Mexico_City');


if (file_exists(dirname(__FILE__) . '/defines.php')) {
	include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
	define('JPATH_BASE', dirname(__FILE__));
	require_once JPATH_BASE.'/includes/defines.php';
	print date('H:i:s')."\tLoading defines...\n";
	
}

require_once JPATH_BASE.DS.'includes'.DS.'framework.php';
require_once JPATH_LIBRARIES.DS.'phpword'.DS.'PHPWord.php';

$docx = new PHPWord();

$p3= $docx->loadTemplate(JPATH_TPL.DS."tpl_oficio_y_contrato.docx");

$p3->populate();

$filename = JPATH_TMP.DS.'dom_merge_'.date('Y_m_d_H_i_s').'.docx';
$p3->saveDOM($filename);
print "-----------------------------------------\n";
print date('H:i:s')."\tFinish\n";